<template>
	<view class="container">
		<view class="list-cell">
			<view class="layout-up" v-if="addressList.length>0">
				<view class="layout-personal-info">
					<image class="small-icon" src="@appstatic/img/my/my_orange_address_icon.png">
						<view class="text-1" style="margin-left: 10px;">
							收获地址
						</view>
				</view>
				<view class="layout-1">
					<view class="layout-personal-info">
						<view class="text-1" style="margin-right: 10px;">{{data.addressName}}</view>
						<view class="text-1">{{data.addressPhone}}</view>
					</view>
					<view class="layout-personal-info" @click="editAddress">
						<image class="edit-icon" src="@appstatic/mall/mall_edit_icon_small.png">
							<view class="text-2">修改</view>
					</view>
				</view>
				<view class="text-3" style="margin-right: 50px;margin-top: 1;">
					{{data.addressProvince}} {{data.addressCity}} {{data.addressArea}}
					{{data.addressDetails}}
				</view>
			</view>


			<view v-else>
				<view class="layout-1 tiaozheng" @click="addAdress">
					<view class="layout-personal-info">
						<image class="small-icon" src="@appstatic/img/my/my_orange_address_icon.png">
							<view class="text-1" style="margin-left: 10px;">
								先填写收货地址,再确认订单信息
							</view>
					</view>
					<view class="layout-personal-info" @click="addAdress">
						<view class="text-2">去填写</view>
						<u-icon name="arrow-right" color="#ADB0AE" size="16"></u-icon>
					</view>
				</view>
			</view>
		</view>



		<view class="list-cell" style="margin-top: 28rpx;">
			<view class="info-transverse">
				<view class="text-1">价格明细</view>
			</view>
			<view class="info-transverse">
				<view class="text-3">支付金额</view>
				<view class="text-4">￥{{totalPrice}}</view>
			</view>
			<view class="info-transverse">
				<view class="text-3">支付积分 ( 剩余{{myScore||0}}分 )</view>
				<view class="text-4">{{totalPrcs}}</view>
			</view>
			<view class="info-transverse">
				<view class="text-3">运费</view>
				<view class="text-4">￥{{totalFreight||0}}</view>
			</view>
			<!-- 六期加优惠券 -->
			<view class="info-transverse" style="width: calc(100% - 28px)" v-if="availableCouponistNum>0"
				@click="toMyCardListForUsed">
				<view class="text-3">优惠券</view>
				<view class="layout-personal-info">
					<view class="text-5" style="margin-right: 8rpx;"
						v-if="couponName==undefined||couponName==null||couponName==''">{{availableCouponistNum}} 张可用
					</view>
					<view class="text-4" style="margin-right: 8rpx;width: 200px;text-align: end" v-else>{{couponName}}</view>
					<u-icon name="arrow-right" color="#ADB0AE" size="12"></u-icon>
				</view>
			</view>
			<view class="info-transverse" v-else>
				<view class="text-3">优惠券</view>
				<view class="text-4">暂无可用</view>
			</view>
			<view class="info-transverse" style="width: calc(100% - 28px)" v-if="1==2">
				<view class="text-3">派币</view>
				<view class="calculator">
					<view class="left_i" @tap="editNum(-1)">
						<u-icon name="minus" size="12" color="#000000"></u-icon>
					</view>
					<text class="center_con">{{count}}</text>
					<view class="right_i" @tap="editNum(1)">
						<u-icon name="plus" size="12" color="#000000"></u-icon>
					</view>
				</view>
			</view>

			<view class="info-transverse" style="align-items: flex-start;margin-top: 18rpx;">
				<view class="text-3">订单备注</view>
				<textarea class="uni-text-address" type="text" value='rermark' v-model='rermark' data-type='rermark'
					maxlength="20" ref="textarea" placeholder="请输入备注内容" placeholder-style="color:#ADB0AE" auto-height />
			</view>

		</view>
		<view class="list-cell" style="margin-top: 28rpx;" v-if="(totalPrice+totalFreight)!=0">
			<view class="info-transverse">
				<view class="text-1">支付方式</view>
			</view>

			<radio-group @change="radioChange($event)">
				<label class="info-transverse" v-for="(radioItem, radioIndex) in paytypeList" :key="radioItem.value">
					<view class="layout-personal-info">
						<image class="chooseicon" :src='radioItem.image'></image>
						<text class="text-1" style="margin-left: 20rpx;">{{radioItem.name}}</text>
					</view>
					<view>
						<radio color="#EA5404" style="transform:scale(0.7)" :value="radioItem.value"
							:checked="radioItem.value==paymentFlag" />
					</view>

				</label>
			</radio-group>
		</view>


		<view class="page-bottom iphonex-bottom" id="pageBottom">
			<view class="icon-btn">
				<view class="icon-btn-item">
					<view class="totalPrice">
						<text class="totalPrice_ff">合计:</text>
						<text class="totalPrice_red" style="margin-left: 8rpx;">￥{{hejiPrice}}</text>
					</view>
				</view>
			</view>

			<!-- 正常结算页面 -->
			<view class="buy-btn">
				<view class="to-buy to-store-btn" @click="submitOrder">提交订单</view>
			</view>
		</view>


	</view>
</template>

<script>
	const app = getApp();
	const dialog = require("@/utils/dialog.js");
	const util = require('@/utils/util.js');
	const network = require('@/manager/network-manager.js');
	import dayjs from 'dayjs'
	export default {
		components: {},
		data() {
			return {
				data: null,
				userInfo: app.globalData.userInfo,
				address: '',
				addressList: [],
				refreshList: true,
				totalPrice: '',
				totalPrcs: '',
				hejiPrice: '',
				totalFreight: 0,
				buyList: [],
				// cardList: [],
				// showCardPicker: false,
				consigneeAddress: '',
				couponName: null, //优惠券名称
				couponAmount: null, //优惠金额
				couponNo: null, //优惠券id
				count: 1,
				paytypeList: [{
						value: '01',
						name: '支付宝',
						image: 'https://pfmotortest.hb4oss.xstore.ctyun.cn/appstatic/img/pay-alipay1.png',

					},
					{
						value: '02',
						name: '微信',
						image: 'https://pfmotortest.hb4oss.xstore.ctyun.cn/appstatic/img/pay-wechat1.png'
					}
				],
				paymentFlag: '',
				rermark: '',
				from: '',
				id: '',
				myScore: '',
				availableCouponistNum: 0,
				myAvailableCouponData: {}

			}
		},
		onLoad(options) {
			var that = this
			if (options.from && options.from == 'order') {
				that.from = options.from
				that.id = options.id
				that.paymentFlag = '0' + options.paymentFlag
				if (options.rermark && options.rermark != undefined && options.rermark != null) {
					that.rermark = options.rermark
				}
			} else if (options.from && options.from == 'shoppingCart') {
				that.from = options.from
			}
			that.totalPrice = options.totalPrice
			that.totalPrcs = options.totalPrcs
			that.couponName = options.couponName || null
			that.couponAmount = options.couponAmount || null
			that.couponNo = options.couponNo || null

			//获取到上一页面的商品列表，处理数据，将不同规格的同种商品 归类，方便计算邮费
			that.buyList = JSON.parse(options.buyListJson)
			// var goodList = JSON.parse(options.buyListJson)
			console.log(options.buyListJson + '###3')
			var arr = [] //不累加
			// var totalFreight = 0
			for (var i = 0; i < that.buyList.length; i++) {
				if (that.buyList[i].freightType != "包邮") {
					if (arr.indexOf(that.buyList[i].productId) == -1) {
						if (that.buyList[i].freightType == "累加") {
							that.totalFreight = (that.totalFreight * 100 + Number((that.buyList[i].freightPrice * 100) *
								that.buyList[i].count)) / 100
						} else {
							that.totalFreight = (that.totalFreight * 100 + Number(that.buyList[i].freightPrice * 100)) /
								100
						}
					}
					if (that.buyList[i].freightType == "不累加") {
						arr.push(that.buyList[i].productId)
					}

				}

			}
			that.hejiPrice = (parseFloat(that.totalPrice) * 1000 + parseFloat(that.totalFreight) * 1000 - parseFloat(that
				.couponAmount || 0) * 1000) / 1000
		},
		onShow() {
			if (uni.getStorageSync('couponChoose')) {
				this.refreshList = false
				// this.couponNo = uni.getStorageSync('couponChoose').couponNo
				// this.couponName = uni.getStorageSync('couponChoose').couponName
				var couponNo = uni.getStorageSync('couponChoose').couponNo
				var couponName = uni.getStorageSync('couponChoose').couponName

				uni.setStorageSync('couponChoose', null)
				this.getOrderAmountbyCoupon(couponNo, couponName)
			}
			if (this.refreshList == true) {
				this.getUsersAddressList(true)
				this.getUserScoreAccount()
				this.getMyAvailableCoupon()
			} else {
				this.refreshList = true
			}
		},
		methods: {
			//商城结算-使用优惠卷计算订单金额
			getOrderAmountbyCoupon: function(couponNo, couponName) {
				var that = this;
				var uri = app.globalData.config.interfaces.URL_ACTIVITY_CARD_GETORDERAMOUNTBYCOUPON; //刷新页面配置

				var goodsList = []
				for (var i = 0; i < that.buyList.length; i++) {
					var item = {
						buyCount: that.buyList[i].num || that.buyList[i].count,
						goodsId: that.buyList[i].productId,
						goodsType: that.buyList[i].productType || that.buyList[i].goodsType,
						itemId: that.buyList[i].productItemId || that.buyList[i].itemId,
						payType: that.buyList[i].payType,
						point: that.buyList[i].point,
						price: that.buyList[i].price,
						productCarsId: ''
					}
					if (that.from == 'shoppingCart') {
						item.productCarsId = that.buyList[i].id || '' //购物车商品id
					}
					goodsList.push(item)
				}
				var params = {
					"consigneeAddress": that.consigneeAddress,
					"consigneeName": that.data.addressName,
					"consigneePhone": that.data.addressPhone,
					"freightPrice": that.totalFreight,
					"fromFlag": 3,
					"goodsList": goodsList,
					"orderAmount": that.totalPrice,
					"orderScore": that.totalPrcs,
					"paymentFlag": parseInt(that.paymentFlag),
					"rermark": that.rermark,
					"couponNo": couponNo,
					"couponName": couponName,
					"couponAmount": 0,
					"userId": app.getUserId(),
				};
				network.post(uri, params, 'json',null,true).then(res => {
					if (res.code == 200) {
						if (res.data.couponIsUse == false) {
							uni.showToast({
								title: res.data.msg,
								duration: 3000,
								icon: 'none'
							})
						} else {
							that.couponNo = couponNo
							that.couponName = couponName
							that.couponAmount = res.data.couponAmount
							that.totalPrice = res.data.orderAmount
							that.hejiPrice = (parseFloat(that.totalPrice) * 1000 + parseFloat(that
								.totalFreight) * 1000 - parseFloat(that
								.couponAmount || 0) * 1000) / 1000
						}
					} else {
						uni.showToast({
							title: res.message,
							duration: 3000,
							icon: 'none'
						})
					}
				}).catch(res => {
					uni.showToast({
						title: res.errMsg,
						duration: 3000,
						icon: 'none'
					})
				});
			},
			//用户查询我的卡券 查询可用券数量
			getMyAvailableCoupon: function() {
				var that = this;
				var categoryCodeList = []
				var productCodeList = []
				for (var i = 0; i < that.buyList.length; i++) {
					if (categoryCodeList.indexOf(that.buyList[i].productCategoryCode) == -1) {
						if (that.buyList[i].productCategoryCode && that.buyList[i].productCategoryCode != null) {
							categoryCodeList.push(that.buyList[i].productCategoryCode)
						}
					}
					if (productCodeList.indexOf(that.buyList[i].productNo) == -1) {
						if (that.buyList[i].productNo && that.buyList[i].productNo != null) {
							productCodeList.push(that.buyList[i].productNo)
						}
					}
				}
				var uri = app.globalData.config.interfaces.URL_ACTIVITY_CARD_GETMYAVAILABLECOUPON; //刷新页面配置
				var params = {
					"useScope": '商城',
					"categoryCodeListStr": categoryCodeList.join(','),
					"productCodeListStr": productCodeList.join(','),
					"userId": app.globalData.userInfo.id
				};
				network.get(uri, params, 'json').then(res => {
					if (res.code == 200) {
						that.myAvailableCouponData = res.data
						that.availableCouponistNum = res.data.availableCouponistNum

					} else {
						uni.showToast({
							title: res.message,
							duration: 3000,
							icon: 'none'
						})
					}
				}).catch(res => {
					uni.showToast({
						title: res.errMsg,
						duration: 3000,
						icon: 'none'
					})
				});
			},
			//跳转选择优惠券
			toMyCardListForUsed: function() {
				if (this.availableCouponistNum > 0) {
					uni.navigateTo({
						url: '/module_my/pages/myCardList/myCardListForUsed?myAvailableCouponJson=' + JSON
							.stringify(this.myAvailableCouponData)
					});
				}
			},
			//优惠券使用
			// couponChoose: function(couponNo, couponName) {
			// 	this.refreshDetail = false
			// 	this.couponId = couponNo
			// 	this.couponName = couponName
			// },
			//查询用户积分账户
			getUserScoreAccount: function() {
				var that = this;
				var uri = app.globalData.config.interfaces
					.URL_ACTIVITY_USERSCORE_GETUSERSCOREACCOUNT; ///levc-sys/sendMessage/updateLevcMessageUserReady
				var params = {
					userid: app.getUserId()
				};
				network.get(uri, params, 'form').then(res => {
					if (res.code == 200) {
						if (res.data.score) {
							that.myScore = res.data.score
						}
					} else {
						uni.showToast({
							title: res.message,
							duration: 3000,
							icon: 'none'
						})
					}

				}).catch(res => {
					uni.showToast({
						title: res.errMsg,
						duration: 3000,
						icon: 'none'
					})
					console.error(res);
				});
			},
			radioChange: function(e) {
				this.paymentFlag = e.detail.value
			},
			submitOrder: function() {
				var that = this
				if (that.consigneeAddress == '') {
					uni.showToast({
						title: '请选择收货地址',
						duration: 3000,
						icon: 'none'
					})
				} else if (that.data.addressName == '' || that.data.addressPhone == '') {
					uni.showToast({
						title: '请完善收货人信息',
						duration: 3000,
						icon: 'none'
					})
				} else if (that.paymentFlag == '' && that.hejiPrice !=
					0) {
					uni.showToast({
						title: '请选择支付方式',
						duration: 3000,
						icon: 'none'
					})
				} else {
					if (that.from == 'order') {
						that.editOrder()
					} else {
						that.addOrder()
					}

				}

			},
			//商城结算-新建订单
			addOrder: function() {
				var that = this;
				var goodsList = []
				for (var i = 0; i < that.buyList.length; i++) {
					var item = {
						buyCount: that.buyList[i].num,
						goodsId: that.buyList[i].productId,
						goodsType: that.buyList[i].productType,
						itemId: that.buyList[i].productItemId,
						payType: that.buyList[i].payType,
						point: that.buyList[i].point,
						price: that.buyList[i].price,
						productCarsId: ''
					}
					if (that.from == 'shoppingCart') {
						item.productCarsId = that.buyList[i].id || '' //购物车商品id
					}
					goodsList.push(item)
				}
				var uri = app.globalData.config.interfaces.URL_PRODUCT_PFMALLORDER_ADDORDER; //刷新页面配置
				var params = {
					"consigneeAddress": that.consigneeAddress,
					"consigneeName": that.data.addressName,
					"consigneePhone": that.data.addressPhone,
					"freightPrice": that.totalFreight,
					"fromFlag": 3,
					"goodsList": goodsList,
					"orderAmount": that.totalPrice,
					"orderScore": that.totalPrcs,
					"paymentFlag": parseInt(that.paymentFlag),
					"rermark": that.rermark,

					"couponNo": that.couponNo,
					"couponName": that.couponName,
					"couponAmount": that.couponAmount,

					"userId": app.getUserId(),
				};
				network.post(uri, params, 'json', null, true).then(res => {
					if (res.code == 200) {
						//判断订单是否需要支付积分 如需要先支付积分，如果积分不够退回积分购买失败
						//如果积分支付成功，看看是不是需要支付钱，如果需要就再支付钱 
						//如果不需要支付积分，直接付钱
						if (res.data.price != 0) {
							that.payOrderTime(res.data.id, res.data.expireTime, res.data.price)
						} else {
							uni.redirectTo({
								url: "/module_my/pages/mallList/mallList",
							});
						}
					} else {
						uni.showToast({
							title: res.message,
							duration: 3000,
							icon: 'none'
						})
					}
				}).catch(res => {
					uni.showToast({
						title: res.errMsg,
						duration: 3000,
						icon: 'none'
					})
				});
			},

			//商城结算-新建订单
			editOrder: function() {
				var that = this;
				var goodsList = []
				for (var i = 0; i < that.buyList.length; i++) {
					var item = {
						buyCount: that.buyList[i].num || that.buyList[i].count,
						goodsId: that.buyList[i].productId,
						goodsType: that.buyList[i].productType || that.buyList[i].goodsType,
						itemId: that.buyList[i].productItemId || that.buyList[i].itemId,
						payType: that.buyList[i].payType,
						point: that.buyList[i].point,
						price: that.buyList[i].price
					}
					goodsList.push(item)
				}
				var uri = app.globalData.config.interfaces.URL_PRODUCT_PFMALLORDER_EDITORDER; //刷新页面配置
				var params = {
					"id": that.id,
					"consigneeAddress": that.consigneeAddress,
					"consigneeName": that.data.addressName,
					"consigneePhone": that.data.addressPhone,
					"freightPrice": that.totalFreight,
					"fromFlag": 3,
					"goodsList": goodsList,
					"orderAmount": that.totalPrice,
					"orderScore": that.totalPrcs,
					"paymentFlag": parseInt(that.paymentFlag),
					"rermark": that.rermark,

					"couponNo": that.couponNo,
					"couponName": that.couponName,
					"couponAmount": that.couponAmount,

					"userId": app.getUserId(),
				};
				network.post(uri, params, 'json', null, true).then(res => {
					if (res.code == 200) {
						//判断订单是否需要支付积分 如需要先支付积分，如果积分不够退回积分购买失败
						//如果积分支付成功，看看是不是需要支付钱，如果需要就再支付钱 
						//如果不需要支付积分，直接付钱
						if (res.data.price != 0) {
							that.payOrderTime(res.data.id, res.data.expireTime, res.data.price)
							// that.payOrder(res.data.id)

						} else {
							uni.redirectTo({
								url: "/module_my/pages/mallList/mallList",
							});
						}
					} else {
						uni.showToast({
							title: res.message,
							duration: 3000,
							icon: 'none'
						})
					}
				}).catch(res => {
					uni.showToast({
						title: res.errMsg,
						duration: 3000,
						icon: 'none'
					})
				});
			},
			//判断支付是否超时
			payOrderTime: function(id, expireTime, payOrderPrice) {
				var that = this;
				var uri = app.globalData.config.interfaces
					.URL_SYS_API_GETBEIJINGTIME; ///levc-sys/sendMessage/updateLevcMessageUserReady
				var params = {};
				network.get(uri, params, 'json', null, true).then(res => {
					if (res.code == 200) {
						var nowTime = res.data
						var diff = dayjs(expireTime).diff(dayjs(nowTime))
						if (diff < 0) {
							uni.showToast({
								title: '订单已过期',
								duration: 3000,
								icon: 'none'
							})
						} else {
							that.payOrder(id, payOrderPrice)
						}
					} else {
						uni.showToast({
							title: res.message,
							duration: 3000,
							icon: 'none'
						})
					}

				}).catch(res => {
					uni.showToast({
						title: res.errMsg,
						duration: 3000,
						icon: 'none'
					})
					console.error(res);
				});
			},
			//支付
			payOrder(id, payOrderPrice) {
				var that = this
				//#ifdef APP-PLUS||H5
				let params = {
					paymentChannel: that.paymentFlag,
					outTradeNo: id,
					goodsDescription: `派方摩托车商城订单支付`,
					paymentChannelSubclass: that.paymentFlag,
					price: payOrderPrice
					// openid: uni.getStorageSync('openId')
				};
				let url = app.globalData.config.interfaces.URL_PAYMENT_MALL_ALL;

				network.post(url, params, 'json', null, true).then(res => {
					console.log(res)
					let data = {
						appid: res.appId,
						noncestr: res.nonceStr,
						package: res.package,
						partnerid: res.partnerId,
						prepayid: res.prepayId,
						timestamp: res.timeStamp + '',
						sign: res.sign
					}

					let order = params.paymentChannel === '01' ? (res.orderString + '&sign=' + res.sign) : data;
					console.log("submit order:" + params.paymentChannel === '01' ? order : JSON.stringify(order));
					if (res) {
						uni.requestPayment({
							provider: params.paymentChannel === '01' ? 'alipay' : 'wxpay',
							orderInfo: order,
							success: function(res) {
								console.log("requestPayment success" + JSON.stringify(res));
								if (res.errMsg === "requestPayment:ok") {
									that.hide = false
									that.back()
								}
							},
							fail: function(err) {
								console.log("requestPayment err" + JSON.stringify(res));

								that.hide = false
								that.back()



								// that.checkOrderStatus()
							},
							complete: function(e) {
								console.log("requestPayment complete" + JSON.stringify(e));

							}
						});
					}
				})
				//#endif
				//#ifdef MP-WEIXIN
				let params = {
					paymentChannel: this.paymentFlag,
					openid: uni.getStorageSync('openId'),
					outTradeNo: id,
					goodsDescription: `派方摩托车商城订单支付`,
					paymentChannelSubclass: this.paymentFlag,
					price: payOrderPrice
				};
				let url = app.globalData.config.interfaces.URL_PAYMENT_MALL;

				network.post(url, params, 'json').then(res => {
					console.log(res)
					let data = {
						appid: res.appId,
						noncestr: res.nonceStr,
						package: res.package,
						partnerid: res.partnerId,
						prepayid: res.prepayId,
						timestamp: res.timeStamp + '',
						sign: res.sign
					}

					let order = params.paymentChannel === '01' ? (res.orderString + '&sign=' + res.sign) :
						data;
					console.log("submit order:" + params.paymentChannel === '01' ? order : JSON.stringify(
						order));
					if (res) {
						uni.requestPayment({
							appid: res.appId,
							timeStamp: res.timeStamp + '',
							nonceStr: res.nonceStr,
							package: res.package,
							paySign: res.paySign,
							signType: 'MD5',
							success: function(res) {
								console.log("requestPayment success" + JSON.stringify(res));
								if (res.errMsg === "requestPayment:ok") {
									that.hide = false
									that.back()
								}
							},
							fail: function(err) {
								console.log("requestPayment err" + JSON.stringify(res));
								that.hide = false
								that.back()

								// that.checkOrderStatus()
							},
							complete: function(e) {
								console.log("requestPayment complete" + JSON.stringify(e));
							}
						})
					}
				})
				//#endif

			},

			back() {
				uni.redirectTo({
					url: '/module_my/pages/mallList/mallList'
				})
			},


			editAddress: function() {
				uni.navigateTo({
					url: '/module_my/pages/myAddress/myAddress?from=mallAddress'
				})
			},
			changeAddress: function(item) {
				this.refreshList = false
				this.data = item
				this.consigneeAddress = this.data.addressProvince + " " + this.data
					.addressCity + " " + this.data.addressArea + " " + this.data
					.addressDetails

			},
			//添加新地址
			addAdress: function() {
				uni.navigateTo({
					url: "/module_my/pages/editAddress/editAddress",
				});
			},

			//获取地址列表
			getUsersAddressList: function(isRefresh) {
				var that = this;
				var uri = app.globalData.config.interfaces.URL_ADDRESS_GET_USER_ADDRESS_LIST; //刷新页面配置
				var params = {
					"pageNum": 1,
					"pageSize": 100,
					"userId": app.globalData.userInfo.id,
				};
				network.get(uri, params, 'json').then(res => {
					if (res.code == 200) {
						//课包状态
						that.addressList = res.data.list;
						if (that.addressList.length > 0) {
							that.data = null
							for (var i = 0; i < that.addressList.length; i++) {
								if (that.addressList[i].isDefault == 1) {
									that.data = that.addressList[i]
									that.consigneeAddress = that.data.addressProvince + " " + that.data
										.addressCity + " " + that.data.addressArea + " " + that.data
										.addressDetails
								}
							}
							if (that.data == null) {
								that.data = that.addressList[0]
								that.consigneeAddress = that.data.addressProvince + " " + that.data
									.addressCity + " " + that.data.addressArea + " " + that.data
									.addressDetails
							}
						} else {
							uni.showToast({
								title: '请填写收货地址',
								duration: 3000,
								icon: 'none'
							})
						}


					} else {
						uni.showToast({
							title: res.message,
							duration: 3000,
							icon: 'none'
						})
					}
				}).catch(res => {
					uni.showToast({
						title: res.errMsg,
						duration: 3000,
						icon: 'none'
					})
				});
			},

			editNum(type) { //编辑数量
				var that = this
				if (!(that.count == 1 && type == -1)) {
					that.count += type
				}
			},

			selectItem(current) {
				if (this.payType == current) return
				this.payType = current
			},



		}
	}
</script>

<style>
	page {
		background-image: url(https://pfmotortest.hb4oss.xstore.ctyun.cn/appstatic/img/my_logo_bg.png);
		width: 100%;
		height: 100%;
		background-repeat: space;
		background-size: 100%;
	}
</style>
<style scoped lang="scss">
	.list-cell {
		background-color: white;
		display: flex;
		flex-direction: column;
		margin-left: 16px;
		margin-right: 16px;
		border-radius: 4px;
	}

	.layout-up {
		flex-direction: column;
		display: flex;
		margin-left: 16px;
		margin-right: 16px;
		margin-top: 10px;
		margin-bottom: 10px;
	}



	.layout-1 {
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}

	.tiaozheng {
		margin-left: 16px;
		margin-right: 16px;
		margin-top: 10px;
		margin-bottom: 10px;
	}

	.layout-personal-info {
		display: flex;
		flex-direction: row;
		align-items: center;
	}

	.edit-icon {
		width: 18px;
		height: 18px;
		align-self: center;
		margin: 6px;
	}

	.info-transverse {
		width: calc(100% - 64rpx);
		height: 88rpx;
		margin-left: 32rpx;
		display: flex;
		flex-direction: row;
		justify-content: space-between;
		align-items: center;
	}

	.chooseicon {
		width: 40rpx;
		height: 40rpx;
	}

	.calculator {
		display: flex;

		.left_i {
			width: 54rpx;
			height: 48rpx;
			background: #FFFFFF;
			border-radius: 4px 0px 0px 4px;
			border: 1px solid #EDEDED;
			display: flex;
			align-items: center;
			justify-content: center;
		}

		.center_con {
			width: 54rpx;
			height: 48rpx;
			background: #FFFFFF;
			border: 1px solid #EDEDED;
			display: flex;
			align-items: center;
			justify-content: center;
		}

		.right_i {
			width: 54rpx;
			height: 48rpx;
			background: #FFFFFF;
			border-radius: 0px 4px 4px 0px;
			border: 1px solid #EDEDED;
			display: flex;
			align-items: center;
			justify-content: center;
		}
	}

	.text-1 {
		font-style: normal;
		font-weight: 400;
		font-size: 28rpx;
		line-height: 40rpx;
		color: #3D3A3A;
		word-break: break-all;
	}

	.text-2 {
		font-style: normal;
		font-weight: 400;
		font-size: 24rpx;
		line-height: 34rpx;
		color: #ADB0AE;
		word-break: break-all;
	}

	.text-3 {
		font-style: normal;
		font-weight: 400;
		font-size: 28rpx;
		line-height: 40rpx;
		color: #ADB0AE;
		word-break: break-all;
	}

	.text-4 {
		font-style: normal;
		font-weight: 400;
		font-size: 28rpx;
		line-height: 36rpx;
		color: #3D3A3A;
		word-break: break-all;

	}

	.text-5 {
		font-style: normal;
		font-weight: 400;
		font-size: 28rpx;
		line-height: 36rpx;
		color: #EA5404;
		word-break: break-all;

	}

	.uni-text-address {
		font-style: normal;
		width: 200px;
		font-weight: 400;
		font-size: 28rpx;
		line-height: 36rpx;
		color: #3D3A3A;
		text-align: right;
		height: auto;
		word-break: break-all;
	}

	.small-icon {
		width: 16px;
		height: 16px;
	}

	.page-bottom {
		position: fixed;
		bottom: 0;
		left: 0;
		// z-index: 9;
		background: #fff;
		height: 144rpx;
		width: 100%;
		display: flex;
		border-top: 1rpx solid #f2f2f2;
		box-sizing: border-box;
		padding: 32upx;
		align-items: center;

		.icon-btn {
			display: flex;
			align-items: center;

			flex: 1;

			.icon-btn-item {
				flex: 1;
				position: relative;
				text-align: center;
				font-size: 22rpx;
				color: #262626;
				display: flex;
				flex-direction: row;
				width: 100%;
				height: 100%;
				align-items: center;
				justify-content: start;

				.totalPrice {

					.totalPrice_ff {
						font-style: normal;
						font-weight: 400;
						font-size: 28rpx;
						line-height: 28rpx;
						color: #3D3A3A;
					}

					.totalPrice_red {
						font-style: normal;
						font-weight: 400;
						font-size: 32rpx;
						line-height: 40rpx;
						color: #EA5404;

					}
				}

			}
		}

		.buy-btn {
			// flex:1.5;
			display: flex;
			align-items: center;
			height: 72rpx;
			border: 1px solid #EA5404;

			.to-buy {
				background: #EA5404;
				color: #fff;
			}

			>.to-store-car {
				color: #EA5404;
			}

			>.to-store-btn {
				flex: 1;
				width: 240rpx;
				text-align: center;
				line-height: 72rpx;
				font-size: 28rpx;
				padding: 0;
			}
		}
	}
</style>
